package longcaisuyun.longcai.com.net;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/4/25.
 */
@HttpInlet(Net.QIANGDATA)
public class PostDingData extends WHAsyPost<PostDingData.Info> {
    public String driverid;
    public String orderid;

    public PostDingData(String driverid, String orderid, AsyCallBack asyCallBack) {
        super(asyCallBack);
        this.driverid = driverid;
        this.orderid = orderid;
    }

    @Override
    protected Info parser(JSONObject object) {
        Info info = new Info();
        info.message = object.optString("message");
        if (info.message.equals("1")) {
            info.ordertype = object.optString("ordertype");
            info.usetime = object.optString("usetime");
            info.week = object.optString("week");
            info.time = object.optString("time");
            info.account = object.optString("account");
            info.reward = object.optString("reward");
            info.totalmoney = object.optString("totalmoney");
            info.payttime = object.optString("payttime");
            info.range = object.optString("range");
            info.tip=object.optString("tip");
            info.saycontent = object.optString("saycontent");
            JSONArray array = object.optJSONArray("addresslist");
            if (array != null) {
                for (int j = 0; j < array.length(); j++) {
                    info.list.add(array.optJSONObject(j).optString("address"));
                    info.listDiZhi.add(array.optJSONObject(j).optString("point"));
                }
            }
            return info;
        }
        return null;
    }

    public static class Info {
        public String message = "";
        public String ordertype = "";
        public String usetime = "";
        public String week = "";
        public String time = "";
        public String account = "";
        public String reward = "";
        public String totalmoney = "";
        public String payttime="";
        public String saycontent="";
        public String range="";
        public String tip="";
        public List<String> list = new ArrayList<>();
        public List<String> listDiZhi=new ArrayList<>();
    }
}
